const fs = require("fs");
var newobj = {"name":"刘强","age":21}
fs.readFile("person.json",function(error,data){
    if(error) throw error;
// 将字符串转换成json对象
    // 对json 数据进行处理
    var person = JSON.parse(data.toString());
    person.push(newobj);
    var str=JSON.stringify(person)
   fs.writeFile("person.json",str,function(error){
       if(error) throw error;
       console.log("数据写入成功")
   })
})